/*     */ package com.lmpop.trade.ti_knowledge;
/*     */ 
/*     */ import com.lmpop.frame.QueryList;
/*     */ import com.lmpop.frame.SysMap;
/*     */ import com.lmpop.frame.TradeInterf;
/*     */ import com.lmpop.frame.dao.DbmInterf;
/*     */ import com.lmpop.frame.exp.ApplicationException;
/*     */ import com.lmpop.frame.util.FileIO;
/*     */ import com.lmpop.updateHtml.parseXml.Config;
/*     */ import com.lmpop.updateHtml.updateHtml.UpdateArticleHtml;
/*     */ import java.util.Hashtable;
/*     */ import java.util.List;
/*     */ 
/*     */ public class Ti_knowledgeInfo
/*     */   implements TradeInterf
/*     */ {
/*     */   QueryList queryList;
/*     */   UpdateArticleHtml uah;
/*     */   FileIO io;
/*     */   Config conf;
/*     */   String rootpath;
/*     */ 
/*     */   public Ti_knowledgeInfo()
/*     */   {
/*  22 */     this.queryList = new QueryList();
/*  23 */     this.uah = new UpdateArticleHtml();
/*  24 */     this.io = new FileIO();
/*  25 */     this.conf = new Config();
/*  26 */     this.conf.init();
/*  27 */     this.rootpath = this.conf.getString("rootpath");
/*     */   }
/*     */ 
/*     */   public SysMap insert(DbmInterf dbmMgr, SysMap map)
/*     */   {
/*  36 */     Ti_knowledge ti_knowledge = new Ti_knowledge();
/*  37 */     ti_knowledge.setInfo_id(map.getString("info_id"));
/*  38 */     ti_knowledge.setCust_id(map.getString("cust_id"));
/*  39 */     ti_knowledge.setClass_attr(map.getString("class_attr"));
/*  40 */     ti_knowledge.setTitle(map.getString("title"));
/*  41 */     ti_knowledge.setKeyword(map.getString("keyword"));
/*  42 */     ti_knowledge.setContent(map.getString("content"));
/*  43 */     ti_knowledge.setIs_recom(map.getString("is_recom"));
/*  44 */     ti_knowledge.setIn_date(map.getString("in_date"));
/*  45 */     ti_knowledge.setUser_id(map.getString("user_id"));
/*     */ 
/*  47 */     String result_code = "0";
/*     */     try {
/*  49 */       insert(dbmMgr, ti_knowledge);
/*     */     } catch (ApplicationException e) {
/*  51 */       e.printStackTrace();
/*  52 */       result_code = "1";
/*     */     }
/*  54 */     map.setString("result_code", result_code);
/*  55 */     return map;
/*     */   }
/*     */ 
/*     */   public void insert(DbmInterf dbmMgr, Ti_knowledge ti_knowledge)
/*     */     throws ApplicationException
/*     */   {
/*  64 */     dbmMgr.update("insertTi_knowledge", ti_knowledge);
/*     */   }
/*     */   public SysMap create_alterPage(DbmInterf dbmMgr, SysMap map) {
/*  67 */     this.uah.updateArticleByGoodsId("o4c141S60ghHCS3", map.getString("info_id"), "0", "1");
/*  68 */     return map;
/*     */   }
/*     */ 
/*     */   public SysMap delete(DbmInterf dbmMgr, SysMap map)
/*     */   {
/*  77 */     String pkid_string = map.getString("pkid");
/*  78 */     String result_code = "0";
/*     */     try {
/*  80 */       if (!pkid_string.equals("")) {
/*  81 */         String[] pkStr = pkid_string.split("\\|");
/*  82 */         List list = null;
/*  83 */         String publish_date = "";
/*  84 */         for (int i = 0; i < pkStr.length; i++)
/*  85 */           if (!pkStr[i].equals("")) {
/*  86 */             list = this.queryList.getList("getTi_knowledgeByPk", pkStr[i]);
/*  87 */             publish_date = ((Hashtable)list.get(0)).get("in_date").toString();
/*  88 */             publish_date = publish_date.substring(0, 10);
/*  89 */             delete(dbmMgr, pkStr[i]);
/*  90 */             FileIO.DelFile(this.rootpath + "/data/jinseyaoshi/knowledge/" + publish_date + "/" + pkStr[i] + ".html");
/*  91 */             FileIO.DelFile(this.rootpath + "/data/jinseyaoshi/knowledge/" + publish_date + "/" + pkStr[i] + ".html");
/*     */           }
/*     */       }
/*     */     }
/*     */     catch (ApplicationException e) {
/*  96 */       e.printStackTrace();
/*  97 */       result_code = "1";
/*     */     }
/*  99 */     map.setString("result_code", result_code);
/* 100 */     return map;
/*     */   }
/*     */ 
/*     */   public void delete(DbmInterf dbmMgr, String pkid)
/*     */     throws ApplicationException
/*     */   {
/* 109 */     dbmMgr.update("deleteTi_knowledge", pkid);
/*     */   }
/*     */ 
/*     */   public SysMap update(DbmInterf dbmMgr, SysMap map)
/*     */   {
/* 118 */     Ti_knowledge ti_knowledge = new Ti_knowledge();
/* 119 */     ti_knowledge.setInfo_id(map.getString("info_id"));
/* 120 */     ti_knowledge.setCust_id(map.getString("cust_id"));
/* 121 */     ti_knowledge.setClass_attr(map.getString("class_attr"));
/* 122 */     ti_knowledge.setTitle(map.getString("title"));
/* 123 */     ti_knowledge.setKeyword(map.getString("keyword"));
/* 124 */     ti_knowledge.setContent(map.getString("content"));
/* 125 */     ti_knowledge.setIs_recom(map.getString("is_recom"));
/* 126 */     ti_knowledge.setIn_date(map.getString("in_date"));
/* 127 */     ti_knowledge.setUser_id(map.getString("user_id"));
/*     */ 
/* 129 */     String result_code = "0";
/*     */     try {
/* 131 */       update(dbmMgr, ti_knowledge);
/* 132 */       this.uah.updateArticleByGoodsId("o4c141S60ghHCS3", map.getString("info_id"), "0", "1");
/*     */     } catch (ApplicationException e) {
/* 134 */       e.printStackTrace();
/* 135 */       result_code = "1";
/*     */     }
/* 137 */     map.setString("result_code", result_code);
/* 138 */     return map;
/*     */   }
/*     */ 
/*     */   public void update(DbmInterf dbmMgr, Ti_knowledge ti_knowledge)
/*     */     throws ApplicationException
/*     */   {
/* 147 */     dbmMgr.update("updateTi_knowledge", ti_knowledge);
/*     */   }
/*     */ 
/*     */   public List getListByPage(Object obj, int start, int limit)
/*     */   {
/* 157 */     Hashtable ti_knowledge = (Hashtable)obj;
/* 158 */     if (start == 0)
/* 159 */       start = 0;
/*     */     else {
/* 161 */       start = (start - 1) * limit;
/*     */     }
/* 163 */     ti_knowledge.put("start", Integer.valueOf(start));
/* 164 */     ti_knowledge.put("limit", Integer.valueOf(limit));
/* 165 */     return this.queryList.getList("getListByTi_knowledgePage", ti_knowledge);
/*     */   }
/*     */   public List getListByCust(Object obj, int start, int limit) {
/* 168 */     Hashtable ti_knowledge = (Hashtable)obj;
/* 169 */     if (start == 0)
/* 170 */       start = 0;
/*     */     else {
/* 172 */       start = (start - 1) * limit;
/*     */     }
/* 174 */     ti_knowledge.put("start", Integer.valueOf(start));
/* 175 */     ti_knowledge.put("limit", Integer.valueOf(limit));
/* 176 */     return this.queryList.getList("getListByTi_knowledgeCust", ti_knowledge);
/*     */   }
/*     */ 
/*     */   public int getCountByObj(Object obj)
/*     */   {
/* 187 */     Hashtable ti_knowledge = (Hashtable)obj;
/* 188 */     List list = this.queryList.getList("getCountByObjTi_knowledge", ti_knowledge);
/* 189 */     int count = 0;
/* 190 */     if ((list != null) && (list.size() > 0)) {
/* 191 */       Hashtable newsMap = (Hashtable)list.get(0);
/* 192 */       if ((newsMap.get("count") != null) && (!newsMap.get("count").toString().equals(""))) {
/* 193 */         count = Integer.parseInt(newsMap.get("count").toString());
/*     */       }
/*     */     }
/* 196 */     return count;
/*     */   }
/*     */ 
/*     */   public List getListByPk(String pk)
/*     */   {
/* 206 */     return this.queryList.getList("getTi_knowledgeByPk", pk);
/*     */   }
/*     */ }

/* Location:           F:\电商\commons-utils.jar
 * Qualified Name:     com.lmpop.trade.ti_knowledge.Ti_knowledgeInfo
 * JD-Core Version:    0.6.0
 */